package com.zhuangyuan.cloud.data.repository.sqlite;

import com.zhuangyuan.cloud.data.entities.CateCategory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Repository
public interface CateCategoryRepository extends JpaRepository<CateCategory,String> {
    @Query(nativeQuery = true,value = "select c.id,c.parent_id from h_category c inner join h_cate_category cc on c.id = cc.category_id where cc.cate_id = :cateId")
    Map<String,Object> findCategoryIdByCateId(@Param("cateId") String cateId);
    CateCategory findByCateId(String cateId);
}
